﻿@model CategoryModel
@{
    string mode = Model.Id == 0 ? "Add" : "Edit";
    ViewData["Title"] = Model.Id == 0
        ? "Add category"
        : "Edit category " + Model.Id;
}

<h2 class="mt-2">@ViewData["Title"]</h2>

<script src="~/lib/jscolor/jscolor.min.js"></script>
<script>jscolor.dir = "/lib/jscolor/";</script>

<div class="row">
    <div class="col-lg-4">
        <form asp-action="@mode" method="post">
            <div class="form-group">
                <label asp-for="Name" class="required"></label>
                <input asp-for="Name" required maxlength="255" class="form-control" />
            </div>
            <div class="form-group">
                <label asp-for="SortOrder" class="required">Sortorder</label>
                <input asp-for="SortOrder" required maxlength="1" class="form-control" />
            </div>
            <div class="form-group">
                <label asp-for="Color" class="required"></label>
                <input asp-for="Color" class="color {required:false,adjust:false,hash:true,caps:false} form-control" />
            </div>
            <div class="form-group">
                <label class="required" asp-for="IsPublic">Visible</label>
                <div class="custom-control custom-checkbox">
                    <input class="custom-control-input" asp-for="IsPublic" />
                    <label class="custom-control-label" asp-for="IsPublic">Yes</label>
                </div>
            </div>
            <div class="form-group">
                <label class="required" asp-for="IsEligible"></label>
                <div class="custom-control custom-checkbox">
                    <input class="custom-control-input" asp-for="IsEligible" />
                    <label class="custom-control-label" asp-for="IsEligible">Yes</label>
                </div>
            </div>
            <div class="form-group">
                <button type="submit" class="btn-primary btn">Save</button>
            </div>
        </form>
    </div>
</div>
